#ifndef InclusionGuard_SoundPotInstrumentFactory_h
#define InclusionGuard_SoundPotInstrumentFactory_h

#include <string>
#include <list>
#include <map>
#include "SoundPotInstrument.h"
#include "SoundPotSound.h"
#include "SoundPotSoundTypeSpecificInstrumentFactory.h"


namespace SoundPot
{
	class InstrumentFactory
	{
	public:
		
		InstrumentFactory();

		/// Destructs automatically all created instruments!
		~InstrumentFactory();

		///	Registers a sound type like Vst or UniversalMidi.
		void registerSoundType(Sound::Type type, SoundTypeSpecificInstrumentFactory* specificFactory);

		/// Creates the instrument identified by the specified instrument id.
		Instrument* createInstrument(const std::string& instrumentID);

		/// Creates an empty instrument with the specified sound type.
		Instrument* createNewInstrument(Sound::Type soundType);

		/// Deletes an instrument.
		void deleteInstrument(Instrument* instrument);

		/// Deletes all instruments which where created by this factory.
		void deleteAllInstruments();

	private:

		/// Keeps track of all created instruments.
		std::list<Instrument*>* existingInstruments;

		/// Contains all registered sound type specific factories.
		std::map<Sound::Type, SoundTypeSpecificInstrumentFactory*> specificFactories;

	};

}

#endif